home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1996 March
/
EnigmA AMIGA RUN 05 (1996)(G.R. Edizioni)(IT)[!][issue 1996-03][Skylink CD IV].iso
/
earcd
/
graphics
/
dofcalc.lha
/
DOFCalc.DOC
next >
Wrap
Text File
|
1996-02-04
|
7KB
|
153 lines
DOFCalc 0.9 BETA - Illustrated Depth of Field Calculator
by John-Mark Austin
DOFCalc is a modeler macro designed to allow the user to experiment and
visualize different depth of field settings without rendering out dozens
of test frames. It does this by calculating the distance from the camera
to the object, the "near" and "far" distances, and the hyperfocal
distance, ie, the distance at which "far" is infinity.
To do this, DOFCalc requires lots of user input, but since it remembers
the values you give it, the bulk of information only has to be entered once.
(Please note that DOFCalc stores its variables in the T: assigned directory.
If this directory is in RAM: your variables will be reset when you reboot.
If T: is assigned to a hard drive, your variables should appear each time
you run the program).
OK. Let's get started.
1) Run the macro. (The first time the macro is run the data entry boxes
default to Lightwave's default values.)
2) On page 1, enter the camera and target x,y,z settings from the desired
frame in layout. Click "OK" to advance to page 2.
5) Page 2 is where we'll be entering the actual lens settings. In the
Equivalent Lens box, enter the equivalent lens value returned by
Layout in the camera control panel. (This value is the result of the
selected film size and zoom factor).
6) In the F/Stop box, enter the value from the Layout camera control panel
F/Stop box.
7) The Calculated Distance line is simply the distance from the camera to
the target. This provides you with a good starting place for setting
the focal distance, so enter the calculated distance into the Focal
Distance box.
8) For the moment the Confusion Diameter should probably be around 0.05 mm.
Calibrating this value is a bit involved so we'll come back to this
later.
9) Clicking "OK" brings up page 3 which shows the results of our
calculations. Distance to Near represents the inside margin of focus.
Objects closer than this margin should (hopefully) appear out of focus.
Distance to object is just the same calculated distance that was
displayed on page 2. Distance to Far is the outside margin of focus,
beyond which objects should progress out of focus. The Hyperfocal
Distance is the distance beyond which "Far" is infinity.
10) Clicking "YES" at this point tells DOFCalc to illustrate the current
settings IN THE CURRENTLY SELECTED LAYER. If you don't want the plot
to go here select "NO" and change to a free layer, then run the macro
again - it will remember your entries.
11) If you clicked "YES" on page 3, DOFCalc will take a few seconds to
plot the following:
- a single point at the camera's location
- a single point at the target's location
- a sphere representing the "Near" focal margin with the surface name
"DOF: Near Focus"
- a sphere representing the "Far" focal margin with the surface name
"DOF: Far Focus"
12) These objects can be used in several helpful ways.
- The spheres can be exported to layout and parented to a NULL object
that the camera is also parented to. (This, by the by, is the
preferred way to handle camera motion, as the NULL can handle x,y,z
motions and the camera handles h,p,b motions - thus allowing
different splines to interact on the same object).
The big advantage to doing this is that as the camera moves, the
layout window provides you with a 3-D view of your depth of field.
Naturally, this method assumes that the camera doesn't have any x,y,z
offset from the NULL and the lens settings do not change over time.
- Alternatively, use a macro like Sceneload.lwm to load your entire
scene into Modeler. By putting the scene in the background and the
plot in the forground, you can visualize whether or not your
settings are in the right ballpark.
This method has the advantage of speed, allowing you to try numerous
settings in a short amount of time.
13) OK. By now you may have rendered a test frame and discovered that
DOFCalc's representation of your camera settings is way off.
Remember the circles of confusion diameter that we skipped over
before? Well now we need to give it some meaningful value.
Create an xz grid object that is roughly the size of your scene with
about ten to twenty divisions across the entire scene. These
divisions should be equally spaced at some known distance like five
or ten meters depending on the size of your scene. Move the grid so
that one side of the grid is at x = 0.
Export the grid object into Layout and parent it to the camera NULL.
From the camera's perspective, rotate the grid heading until it points
at the target and allows you to clearly see the divisions you created.
If your scene is huge, clear out all of your objects other than the
grid, the target object, the near and far spheres, and the camera NULL.
Turn on Depth of Field and render out a WIREFRAME of your scene. The
grid provides you with a reference. Hopefully, at some point, the
grid will be out of focus on the far side of the far margin. Count
the number of divisions to that point and return to Modeler.
(Note that if your camera is zoomed in very much you may be missing
the first couple of grid lines, so you may need a more sophisicated
grid object with numbers or different surface colors denoting distance).
If you deleted your DOFCalc plot and the grid, run the macro again and
recreate the plot. Then import your grid into another layer. Use
the move requester and move the grid to the camera coordinates.
Rotate it so it's orientation roughly matches its positioning in Layout.
Now for the fudge factor. Move to an empty layer and put the grid in
the background. Run DOFCalc again and leave all your settings the
same except for Confusion Diameter on page 2. Adjust this value up
or down so that when the plot is complete, the FAR MARGIN is just
in front of the grid object segment that was out of focus.
Now DOFCalc should be roughly calibrated to your scene. Adjusting
the settings OTHER THAN CONFUSION DIAMETER shoud provide something
resembling real world results.
So far, meaningful Confusion Diameter values seem to be falling
between 0.025 and 0.05. Ernie Wright's article indicates that for
Medium Overscan work, Confusion Diameter should be no less than 0.05 mm
though I found 0.032 worked for one of my scenes.
A few comments:
1) This is a BETA version of this program is very likely to have some
significant bugs in it. As such, it may be of little use to most
users. Hopefully as I learn more about ARexx and Depth of Field, I can
shake the bugs out and end up with a useful utility.
2) This program should be used hand in hand with the article "Depth of
Field - Improving Your Image Through Imperfection" by Ernie Wright
(LightwavePro, December 1994, Vol. 2, No. 12, pp. 4-5).
3) A correct understanding of circles of confusion is essential for
effective use of DOFCalc, and changing this value in the program will
yield widely varying results. To make matters worse, obtaining a
meaningfull value for confusion diameter is subjective at best.